using System;
using System.Collections.Generic;
using System.Text;
using System.Net;

namespace FiveStone.MyStack
{
    public class Config
    {

        public static IPAddress GetLocalIP()
        {
            IPHostEntry ieh = Dns.GetHostByName(Dns.GetHostName());
            return ieh.AddressList[0];
        }

        public const int PORT = 7500;

        
        //
        public const byte C_Quit = 0x00;//quit
        public const byte C_Join = 0x01;//join
        public const byte C_Put = 0x02;//put
        public const byte C_Message = 0x03;//message

        public const int HEAD_NAME_SIZE = 20;
        public const int HEAD_BOOT_SIZE = 2;
        public const int HEAD_IP_SIZE = 4;
        public const int HEAD_PORT_SIZE = 2;
        public const int HEAD_LEN_SIZE = 4;

        public const int HEAD_FLAG_INDEX = 2;
        public const int HEAD_IP_INDEX = 3;
        public const int HEAD_PORT_INDEX = 7;
        public const int HEAD_NAME_INDEX = 9;
        public const int HEAD_LEN_INDEX = 29;
        public const int HEAD_BODY_INDEX = 33;

        public const int HEAD_SIZE = 33;
        public const int USER_SIZE = 30;       //id:10,name:16,ip:4 
        public const int BUFFER_SIZE = 1024;
        public const int CHESS_SIZE = 8;
        public const int MSG_SIZE = 1024;
        public const byte BOOT1 = 0x88;
        public const byte BOOT2 = 0x0A;

        public const int CHEESE_X_SIZE = 4;
        public const int CHEESE_Y_SIZE = 4;

        public const int CHEESE_X_INDEX = 0;
        public const int CHEESE_Y_INDEX = 4;

    }
}
